import { Component } from "react"
import { useParams, useLocation, useNavigate } from "react-router-dom"
import { Space, Table, Tag,Button } from 'antd';
function withRouter(Component) {
  return (props) => (
    <Component
      {...props}
      params={useParams()}
      location={useLocation()}
      navigate={useNavigate()}
    />
  );
}

class Setyu1 extends Component {
  constructor() {
    super()
    this.state = {
      columns: [
        {
          title: '必须包含关键词',
          dataIndex: 'name',
          key: 'name',
          render: (text) => <a>{text}</a>,
        },
        {
          title: '可包含关键词',
          dataIndex: 'age',
          key: 'age',
        },
        {
          title: '不包含关键词',
          dataIndex: 'address',
          key: 'address',
        },
        {
          title: '监控频率',
          key: 'tags',
          dataIndex: 'tags',
          
        },
        {
          title: '操作',
          key: 'action',
          render: (_, record) => (
            <Space size="middle">
              <Button type="primary">编辑</Button>
              <Button type="primary" danger>删除</Button>
            </Space>
          ),
        },
      ],
      data: [
        {
          key: '1',
          name: '万叶',
          age: 21,
          address: 'NewPark',
          tags: ['nice'],
        },
        {
          key: '2',
          name: '妮露',
          age: 19,
          address: 'LakePark',
          tags: ['loser'],
        },
        {
          key: '3',
          name: '胡桃',
          age: 18,
          address: 'LakePark',
          tags: ['teacher'],
        },
        {
          key: '4',
          name: '优菈',
          age: 20,
          address: 'LakePark',
          tags: ['teacher'],
        },
        {
          key: '5',
          name: '甘雨',
          age: 20,
          address: 'LakePark',
          tags: ['teacher'],
        },
      ]
    }

  }

  render() {
    console.log(this.props);
    return (
      <div>
        <Table columns={this.state.columns} dataSource={this.state.data} />
      </div>
    )
  }
}

export default withRouter(Setyu1)